/**
 * Created by Cameron on 2/6/14.
 *
 Isosceles Triangle
 Given a number n, print a centered triangle. Example for n=3:
   *
  ***
 *****

 */
public class Isosceles_Triangle_Drawer {
    void draw_isosceles_triangle(int n) {
        for(int i=0; i < n; i++) {
            // print spaces
            for(int j = n-i-1; j>0; j--) {
                System.out.print(" ");
            }
            // print asterixes
            for(int j=0; j < i*2 + 1; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println();
    }

    public static void main(String[] args) {
        Isosceles_Triangle_Drawer triangle_drawer = new Isosceles_Triangle_Drawer();
        triangle_drawer.draw_isosceles_triangle(3);
        triangle_drawer.draw_isosceles_triangle(4);
        triangle_drawer.draw_isosceles_triangle(0);
    }
}
